﻿Public Class pin

    Dim password As String

    Public Sub check_password()
        'My.Settings.pin = "0000"
        Dim i As Integer = 0
        pinProgress.Text = Nothing
        For i = 1 To password.Length
            pinProgress.Text = pinProgress.Text & "*"
        Next

        If (password.Length = My.Settings.pin.Length) Then

            If (password = My.Settings.pin) Then
                Dim settingsForm As New settings
                settingsForm.Show()
                Me.Close()
                password = Nothing
            Else
                MsgBox("Incorrect PIN entered")
                password = Nothing
                pinProgress.Text = Nothing
            End If

        End If

    End Sub

    Private Sub Button1_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button1.Click
        password = password & "1"
        check_password()
    End Sub


    Private Sub Button2_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button2.Click
        password = password & "2"
        check_password()
    End Sub

    Private Sub Button3_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button3.Click
        password = password & "3"
        check_password()
    End Sub

    Private Sub Button4_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button4.Click
        password = password & "4"
        check_password()
    End Sub

    Private Sub Button5_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button5.Click
        password = password & "5"
        check_password()
    End Sub

    Private Sub Button6_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button6.Click
        password = password & "6"
        check_password()
    End Sub

    Private Sub Button7_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button7.Click
        password = password & "7"
        check_password()
    End Sub

    Private Sub Button8_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button8.Click
        password = password & "8"
        check_password()
    End Sub

    Private Sub Button9_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button9.Click
        password = password & "9"
        check_password()
    End Sub

    Private Sub Button0_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles Button0.Click
        password = password & "0"
        check_password()
    End Sub

    Private Sub cancel_Click(ByVal sender As System.Object, ByVal e As System.EventArgs) Handles cancel.Click
        Me.Close()

    End Sub
End Class